package com.qingcloud.base.api.remote.eqcenter;

import com.qingcloud.base.api.remote.eqcenter.factory.EqcenterApiFallbackFactory;
import com.qingcloud.base.constant.AppNameConstant;
import com.qingcloud.base.pojo.ApiResult;
import com.qingcloud.base.remote.eqcentor.CommandInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 指令中心
 *
 * @author zhoujun
 */
@FeignClient(contextId = "eqcenterApi", path = "eqcentor", value = AppNameConstant.APP_EQCENTER, fallbackFactory = EqcenterApiFallbackFactory.class)
public interface EqcenterApi {

    /**
     * 下发指令
     */
    @PostMapping("downcommand/send")
    ApiResult sendCommand(@RequestBody CommandInfo commandInfo);

    /**
     * 解码消息查询
     */
    @GetMapping("downcommand/decoder/message")
    ApiResult decodeMessage(@RequestParam("equipmentId") String equipmentId,
                            @RequestParam("componentId") Integer componentId);

}
